package org.jgs1904.publisherandlistener.config;

import org.jgs1904.publisherandlistener.event.MyTestEvent;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.event.EventListener;

/**
 * @EventListener 注解
 * @author: 默苍璃
 * @date: 2023-11-03 18:51
 */
@Configuration
public class Config {
    @EventListener(classes = {ApplicationEvent.class, MyTestEvent.class})
    public void listen(ApplicationEvent event) {
        System.out.println("事件触发666：" + event.getClass().getName());
    }


    @EventListener(classes = {MyTestEvent.class})
    public void listen1(ApplicationEvent event) {
        System.out.println("事件触发：" + 666);
    }


}
